﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using DataAccessClasses;
using System.Data.Common;
using System.Data;

namespace mobliebo
{
    public class company_info
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _company_id=-99;
        private string _company_name="";
        private string _brand_name="" ;
        private string _services="";
        private string _category="";
        private long _launch_year=1800;
        private bool _is_deleted=false;

        public bool is_deleted
        {
            get
            {
                return _is_deleted;
            }
            set
            {
                _is_deleted=value;
            } 
        }
            public long company_id
        {
            get
            {
                return _company_id;
            }
            set
            {
                _company_id=value;
            }
            }    
                public string company_name
        {
            get
            {
                return _company_name;
            }
            set
            {
                _company_name=value;
            } 
                }
        public string brand_name
        {
            get
            {
                return _brand_name;
            }
            set
            {
               _brand_name=value;
            }
        }
        public string services
        {
            get
            {
                return _services;
            }
            set
            {
               _services=value;
            } 
        }
        public string category
        {
            get
            {
                return _category;
            }
            set
            {
                _category=value;
            } 
        }
        public long launch_year
        {
            get
            {
                return _launch_year;
            }
            set
            {
                _launch_year=value;
            }
    }
        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0=DAC.Parameter("@company_id",company_id,DbType.Int64,ParameterDirection.Input);
                DbParameter dbparam1=DAC.Parameter("@company_name",company_name,DbType.AnsiString,ParameterDirection.Input);
                DbParameter dbparam2=DAC.Parameter("@brand_name",brand_name,DbType.AnsiString,ParameterDirection.Input);
                DbParameter dbparam3=DAC.Parameter("@services",services,DbType.AnsiString,ParameterDirection.Input);
                DbParameter dbparam4=DAC.Parameter("@category",category,DbType.AnsiString,ParameterDirection.Input);
                DbParameter dbparam5=DAC.Parameter("@launch_year",launch_year,DbType.Int64,ParameterDirection.Input);
                 DbParameter dbparam6=DAC.Parameter("@is_deleted",is_deleted,DbType.Boolean,ParameterDirection.Input);

                DbParameter[] dbparamcall=new DbParameter[]{dbparam0,dbparam1,dbparam2, dbparam3, dbparam4,dbparam5,dbparam6};
                return DAC.Save("company_info_save",dbparamcall);
            }
            catch(Exception ex)
            {
                long result=-99;
            }
            return-99;
        }
        public DataTable GetRecords(long company_id,string company_name,string brand_name, string services, string category,int launch_year,bool is_deleted,string andor)
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@company_id", company_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@company_name", company_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@brand_name", brand_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@services", services, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@category", category, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@launch_year", launch_year, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@is_deleted", is_deleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam7 = DAC.Parameter("@andor", andor, DbType.AnsiString, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6, dbparam7 };
                //  return DAC.Select("company_info_get",dbparamcall);
                DataTable dt1 = DAC.Select("company_info_get", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                long result = -99;
            }
            return null;
        }
    }
}


